<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>mac列表</title>
		<link rel="stylesheet" type="text/css" href="../css/public.css" />
		<link rel="stylesheet" href="../bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="../css/font-awesome.min.css">
		<link rel="stylesheet" href="../css/ionicons.min.css">
		<link rel="stylesheet" href="../css/AdminLTE.min.css">
		<link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">
		<link rel="stylesheet" type="text/css" href="../css/bootstrap-datetimepicker.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/public_main.css" />
		<style type="text/css">
			body #select_wuye,
			#select_village,
			#select_build,
			#select_unit {
				display: inline-block;
				/*margin-top: 5px;*/
				width: 124px;
				height: 34px;
				margin-left: 10px;
			}
			
			#ppp label {
				margin-left: 10px;
			}
			
			.remove span {
				cursor: pointer;
			}
			
			.table_cla {
				/*height: 560px;*/
			}
		</style>

	</head>

	<body>
		<div class="box" id="app">
			<div class="box-header with-border">
				<h3 class="box-title">mac列表 </h3>
			</div>
			<div id="mohu" class="my_feilei">
				<label for="name">物业</label>
				<select id="select_wuye" @change="property_change" v-model="organizeid" style="display: inline-block;" class="form-control">
					<option v-for="item in property_name" :value="item.organizeid" v-text="item.shortname"></option>
				</select>
				<label for="name">小区</label>
				<select id="select_village" v-model="areaid" style="display: inline-block;" class="form-control">
					<option v-for="item in village_name" :value="item.areaid" v-text="item.areaname"></option>
				</select>
				<input type="text" name="" id="text_sousuo" v-model="selectinfo" placeholder="请输入需要查询的内容" />
				<button id="search_chaxun" @click="search" type="button" class="btn btn-success">搜索</button>
				<button id="add_mac" data-toggle="modal" data-target="#mac_add" @click="add_mac" type="button" class="btn btn-info">增加</button>
			</div>
			<div style="margin-top: 0px;" class="table_cla">
				<table class="table table-bordered">
					<tr>
						<th>序号</th>
						<th>物业</th>
						<th>小区</th>
						<th>厂商名称</th>
						<th>板子名字 </th>
						<th>mac地址</th>
						<th>创建时间</th>
						<th>创建人 </th>
						<th>操作</th>
					</tr>
					<tbody id="tbbb">
						<tr v-for="(item,index) in tabel_data">
							<td v-text="index+1"></td>
							<td v-text="item.merchantname"></td>
							<td v-text="item.areaname"></td>
							<td v-text="item.manufacturername"></td>
							<td v-text="item.boardname"></td>
							<td v-text="item.macadder"></td>
							<td v-text="item.createdate"></td>
							<td v-text="item.createusername"></td>
							<td class="remove">
								<span style="color: #286090;" data-toggle="modal" data-target="#myModalremove" @click="sure_more(item)" class="glyphicon glyphicon-align-justify">详情&nbsp;</span>
								<span style="color: #f0ad4e;" data-toggle="modal" data-target="#mac_fix" @click="fix_more(item)" class="	glyphicon glyphicon-pencil">修改&nbsp;</span>
								<span style="color: #d43f3a;" data-toggle="modal" data-target="#remove_mac" @click="remove_more(item)" class="glyphicon glyphicon-trash">删除&nbsp;</span>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<!-- /.box-body -->
			<ul class="pagination" style="margin-left: 10px;">
				<span v-text="count_all"></span>
				<!--<li v-show="current != 1" @click="current-- && goto(current--)">
					<a href="#">上一页</a>
				</li>-->
				<li v-for="index in pages" @click="goto(index)" :class="{'active':current == index}" :key="index">
					<a href="#" v-text="index"></a>
				</li>
				<!--<li v-show="allpage != current && allpage != 0 " @click="current++ && goto(current++)">
					<a href="#">下一页</a>
				</li>-->
				<span style="margin-left: 10px;">跳到:</span>
				<!--<input style="width: 50px;height: 34px;" min="1" max="{{allpage}}" type="number" name="goto" id="goto" v-model="jump" />-->
				<input style="width: 50px;height: 28px;" name="goto" id="goto" v-model="jump" type="text" name="" oninput="value=value.replace(/[^\d]/g,'')">
				<span>页</span>
				<button type="button" id="gotoo" @click="goto(jump)" class="btn btn-danger ">确定 </button>
			</ul>
			<!-- 增加模态框（Modal） -->
			<div class="modal fade" id="mac_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">增加mac</h4>
						</div>
						<div class="modal-body" id="shenhe">
							<ul id="ppp">
								<li>
									<span>*物业名字：</span>
									<select id="select_wuye1" @change="property_change1" v-model="organizeid1" style="display: inline-block;" class="form-control">
										<option v-for="item in property_name1" :value="item.organizeid" v-text="item.shortname"></option>
									</select>
								</li>
								<li>
									<span>*小区名字：</span>
									<select id="select_village1" v-model="areaid1" style="display: inline-block;" class="form-control">
										<option v-for="item in village_name1" :value="item.areaid" v-text="item.areaname"></option>
									</select>
								</li>
								<li>
									<span>*厂商名字：</span>
									<select id="vendor_name" v-model="vendor" style="display: inline-block;" class="form-control">
										<option v-for="item in vendor_name" :value="item.id" v-text="item.itemname"></option>
									</select>
								</li>
								<li>
									<span>*mac名字：</span><input type="text" v-model="add_data.boardname" />
								</li>
								<li>
									<span>*mac地址：</span><input type="text" v-model="add_data.macadder" />
								</li>
								<li>
									<span>*备注：</span><textarea v-model="add_data.remarks" name="" rows="" cols=""></textarea>
								</li>

							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" @click="sure_mac_add" class="btn btn-primary">确定增加</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>

			<!-- 修改模态框（Modal） -->
			<div class="modal fade" id="mac_fix" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">修改mac</h4>
						</div>
						<div class="modal-body" id="shenhe">
							<ul id="ppp">
								<li>
									<span>*厂商名字：</span>
									<select id="vendor_name_fix" v-model="vendor" style="display: inline-block;" class="form-control">
										<option v-for="item in vendor_name" :value="item.id" v-text="item.itemname"></option>
									</select>
								</li>
								<li>
									<span>*mac名字：</span><input type="text" v-model="fix_data.boardname" />
								</li>
								<li>
									<span>*mac地址：</span><input type="text" v-model="fix_data.macadder" />
								</li>
								<li>
									<span>*备注：</span><textarea v-model="fix_data.remarks" name="" rows="" cols=""></textarea>
								</li>

							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" @click="sure_mac_fix" class="btn btn-primary sure_fix">确定修改</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>

			<!-- 模态框（Modal） -->
			<div class="modal fade" id="myModalremove" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">mac详情</h4>
						</div>
						<div class="modal-body" id="shenhe">
							<ul id="ppp">
								<li>
									<span>修改时间：</span><label v-text="model_data.modifydate"></label>
								</li>
								<li>
									<span>修改人：</span><label v-text="model_data.modifyusername"></label>
								</li>
								<li>
									<span>备注： </span><label v-text="model_data.remarks"></label>
								</li>
								<li style="display: none;">
									<span>id： </span><label v-text="model_data.macadderid"></label>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<div class="shenhe_no">
								<button type="button" class="btn btn-default fanhui" data-dismiss="modal">返回</button>
								<button type="button" id="restart" @click="restart()" class="btn btn-info">重启</button>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- 模态框（Modal）提示信息 -->
			<div class="modal fade" id="myModal_tips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">提示信息</h4>
						</div>
						<div class="modal-body" id="tips" v-text="tips_modal">

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
			</div>
			<!-- 确认删除 -->
			<div class="modal fade" id="remove_mac" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">是否确认删除</h4>
						</div>
						<div class="modal-body">删除后数据无法找回</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" class="btn btn-danger remove" @click="sureremove">确定删除</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
		</div>

	</body>

</html>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/qunit-1.11.0.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-paginator.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
<script>
	//	var urlr = "http://192.168.0.30:8085"
	new Vue({
		el: '#app',
		data: {
			urltest: "",
			yanli_url: '',
			tips_modal: "",
			selectinfo: "",
			tabel_data: "",
			current: 1,
			showItem: 5,
			rechresult: "",
			allpage: "",
			jump: "",
			userId: "",
			userName: "",
			fullname: "",
			organizeid: "",
			areaid: '',
			organizeid1: "",
			areaid1: '',
			vendor: "",
			count_all: "",
			add_data: {
				boardname: "",
				macadder: "",
				remarks: ""
			},
			fix_data: {
				macadder: "",
				boardname: "",
				manufacturername: "",
				remarks: ""
			},
			model_data: "",
			dat_remove: "",
			vendor_name: [{
				id: "请选择厂商名字",
				areaname: "请选择厂商名字"
			}],
			property_name: [{
				organizeid: "",
				shortname: "请选择物业"
			}],
			property_name1: [{
				organizeid: "",
				shortname: "请选择物业"
			}],
			village_name: [{
				areaid: "",
				areaname: "请选择小区"
			}],
			village_name1: [{
				areaid: "",
				areaname: "请选择小区"
			}],
		},
		//计算属性
		computed: {

		},
		created: function() {

		},
		mounted: function() {
			var that = this;
			that.yanli_url = getUrl_yangli();
			var userId = sessionStorage.getItem("userId");
			if(userId == "" || userId == undefined || userId == null) {
				top.location.href = "../login.html";
			} else {
				that.urltest = sessionStorage.getItem("urltest");
				that.userId = sessionStorage.getItem("userId");
				that.fullname = sessionStorage.getItem("fullname");
				that.userName = sessionStorage.getItem("userName");
				that.organizeid = that.property_name[0].organizeid;
				that.areaid = that.village_name[0].areaid;
				that.organizeid1 = that.property_name1[0].organizeid;
				that.areaid1 = that.village_name1[0].areaid;
				that.vendor = that.vendor_name[0].id;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						merchantid: that.organizeid,
						areaid: that.areaid,
						selectinfo: that.selectinfo,
						pageNumber: 1,
						pageSize: 10
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.tabel_loading(datainit);
				that.wuye_name();
			}

		},
		computed: {
			pages: function() {
				var pag = [];
				if(this.current < this.showItem) { //如果当前的激活的项 小于要显示的条数
					//总页数和要显示的条数那个大就显示多少条
					var i = Math.min(this.showItem, this.allpage);
					while(i) {
						pag.unshift(i--);
					}
				} else { //当前页数大于显示页数了
					var middle = this.current - Math.floor(this.showItem / 2), //从哪里开始
						i = this.showItem;
					if(middle > (this.allpage - this.showItem)) {
						middle = (this.allpage - this.showItem) + 1
					}
					while(i--) {
						pag.push(middle++);
					}
				}
				return pag
			},
		},
		methods: {
			//加载物业
			wuye_name: function(data) {
				var that = this;
				var parentid = data;
				var req3 = JSON.stringify({
					requestString: JSON.stringify({
						parentid: parentid,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + 'verify/property/selectOrganizeNameList',
					data: req3,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.property_name = JSON.parse(msg.returnString);
							that.property_name.unshift({
								organizeid: "",
								shortname: "请选择物业"
							});
							that.property_name1 = JSON.parse(msg.returnString);
							that.property_name1.unshift({
								organizeid: "",
								shortname: "请选择物业"
							});
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//物业改变 小区加载
			property_change: function() {
				var that = this;
				//				console.log(that.organizeid)
				var req3 = JSON.stringify({
					requestString: JSON.stringify({
						merchantid: that.organizeid,
					}),
					userId: that.userId,
					fullname: that.fullname
				})
				if(that.organizeid == '') {
					that.village_name = [{
						areaid: "",
						areaname: "请选择小区"
					}];
					that.areaid = that.village_name[0].areaid;
					return
				}
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/property/selectAreaName',
					data: req3,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.village_name = JSON.parse(msg.returnString);
							that.village_name.unshift({
								areaid: "",
								areaname: "请选择小区"
							});
							that.areaid = that.village_name[0].areaid;
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//物业改变 小区加载
			property_change1: function() {
				var that = this;
				var req3 = JSON.stringify({
					requestString: JSON.stringify({
						merchantid: that.organizeid1,
					}),
					userId: that.userId,
					fullname: that.fullname
				})
				if(that.organizeid1 == '') {
					that.village_name = [{
						areaid: "",
						areaname: "请选择小区"
					}];
					that.areaid = that.village_name1[0].areaid;
					return
				}
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/property/selectAreaName',
					data: req3,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.village_name1 = JSON.parse(msg.returnString);
							that.village_name1.unshift({
								areaid: "",
								areaname: "请选择小区"
							});
							that.areaid = that.village_name1[0].areaid;
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//加载表格
			tabel_loading: function(data) {
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/watch/selectMacAdderList',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							//							console.log(JSON.parse(msg.returnString))
							that.tabel_data = JSON.parse(msg.returnString);
							//							that.count = msg.count;
							var yu = msg.count % 10;
							that.count_all = "共" + msg.count + "条"
							if(yu == 0) {
								that.allpage = parseInt(msg.count / 10);
							} else {
								that.allpage = parseInt(msg.count / 10) + 1;
							}
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//			分页跳转
			goto: function(index) {
				var that = this;
				if(index == that.current) return;
				if(index > that.allpage) {
					return
				}
				var re = /^[1-9]+[0-9]*]*$/ //判断正整数      // /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字  
				if(!re.test(index)) {
					return false;
				}
				this.current = index;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						pageNumber: index,
						pageSize: 10,
						merchantid: that.organizeid,
						areaid: that.areaid,
						selectinfo: that.selectinfo,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.tabel_loading(datainit);
				//这里可以发送ajax请求
			},
			//搜索
			search: function() {
				var that = this;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						pageNumber: 1,
						pageSize: 10,
						merchantid: that.organizeid,
						areaid: that.areaid,
						selectinfo: that.selectinfo,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.tabel_loading(datainit);

			},
			//查看详情
			sure_more: function(data) {
				var that = this;
				that.model_data = data;
			},
			//			修改
			fix_more: function(data) {
				var that = this;
				that.fix_data = data;
				that.get_vendor_name();
				that.vendor = data.vendor;
			},
			//确定修改
			sure_mac_fix: function() {
				$('.sure_fix').prop('disabled', true);
				var that = this;
				var fix_data = JSON.stringify({
					requestString: JSON.stringify({
						modifyuserid: that.userId,
						modifyusername: that.userName,
						macadderid: that.fix_data.macadderid,
						macadder: that.fix_data.macadder,
						boardname: that.fix_data.boardname,
						manufacturername: $("#vendor_name_fix  option:selected").text(),
						remarks: that.fix_data.remarks,

					}),
					userId: that.userId,
					fullname: that.fullname
				});
//				console.log(fix_data)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/watch/updateMacAdder',
					data: fix_data,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							$('.sure_fix').prop('disabled', false);
							$('#mac_fix').modal('hide');
							that.tips_modal = "修改成功";
							$('#myModal_tips').modal('show');
							var datainit = JSON.stringify({
								requestString: JSON.stringify({
									pageNumber: 1,
									pageSize: 10,
									merchantid: that.organizeid,
									areaid: that.areaid,
									selectinfo: that.selectinfo,
								}),
								userId: that.userId,
								fullname: that.fullname
							});
							//							$('#myModal_tips').on('hide.bs.modal', function() {
							that.tabel_loading(datainit);
							//							})							
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
							$('#remove').prop('disabled', false);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
						$('#remove').prop('disabled', false);
					}
				});

			},
			//删除
			remove_more: function(data) {
				var that = this;
				that.dat_remove = JSON.stringify({
					requestString: JSON.stringify({
						deleteuserid: that.userId,
						deleteusername: that.userName,
						macadderid: data.macadderid,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
			},
			//确认删除
			sureremove: function() {
				var that = this;
				$('#remove').prop('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/watch/deleteMacAdder',
					data: that.dat_remove,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							$('#remove').prop('disabled', false);
							$('#remove_mac').modal('hide');
							that.tips_modal = "删除成功";
							$('#myModal_tips').modal('show');
							var datainit = JSON.stringify({
								requestString: JSON.stringify({
									pageNumber: 1,
									pageSize: 10,
									merchantid: that.organizeid,
									areaid: that.areaid,
									selectinfo: that.selectinfo,
								}),
								userId: that.userId,
								fullname: that.fullname
							});
							//							$('#myModal_tips').on('hide.bs.modal', function() {
							that.tabel_loading(datainit);
							//							})							
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
							$('#remove').prop('disabled', false);
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
						$('#remove').prop('disabled', false);
					}
				});
			},
			//获取厂商名字
			get_vendor_name: function() {
				var that = this;
				var data = JSON.stringify({
					fullname: that.fullname,
					requestString: JSON.stringify({
						itemname: "电表厂商名字"
					}),
					userId: that.userId
				});
//				console.log(data)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					//urltest
					url: that.urltest + '/woke/public/selectDataItemByItemcode',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
//							console.log(msg)
							that.vendor_name = JSON.parse(msg.returnString);
							that.vendor_name.unshift({
								id: "请选择厂商名字",
								itemname: "请选择厂商名字"
							});
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
							$('#remove').prop('disabled', false);
						}

					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//			增加
			add_mac: function() {
				var that = this;
				that.get_vendor_name();
				that.vendor = that.vendor_name[0].id;
			},
			//确认增加
			sure_mac_add: function() {
				var that = this;
				if(that.organizeid1 == '') {
					that.tips_modal = "请选择物业";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.areaid1 == '') {
					that.tips_modal = "请选择小区";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.vendor == '请选择厂商名字') {
					that.tips_modal = "请选择厂商名字";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.boardname == '') {
					that.tips_modal = "请填写mac名字";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.macadder == '') {
					that.tips_modal = "请填写mac地址";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.remarks == '') {
					that.tips_modal = "请填写备注";
					$('#myModal_tips').modal('show');
					return
				}
				var data = JSON.stringify({
					fullname: that.fullname,
					requestString: JSON.stringify({
						merchantid: that.organizeid1,
						areaid: that.areaid1,
						areaname: $("#select_wuye1  option:selected").text(),
						merchantname: $("#select_village1  option:selected").text(),
						macadder: that.add_data.macadder,
						boardname: that.add_data.boardname,
						createuserid: that.userId,
						createusername: that.userName,
						manufacturername: $("#vendor_name  option:selected").text(),
						remarks: that.add_data.remarks
					}),
					userId: that.userId
				});
//				console.log(data)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/watch/addMacAdder',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							console.log(msg);
							$("#mac_add").modal('hide');
							that.tips_modal = "增加成功";
							$('#myModal_tips').modal('show');
							var datainit = JSON.stringify({
								requestString: JSON.stringify({
									pageNumber: 1,
									pageSize: 10,
									merchantid: that.organizeid,
									areaid: that.areaid,
									selectinfo: that.selectinfo,
								}),
								userId: that.userId,
								fullname: that.fullname
							});
							that.tabel_loading(datainit);
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});

			},
			//重启板子
			restart:function(){
				var that = this;
				var data = JSON.stringify({
					fullname: that.fullname,					
					userId: that.userId,
					requestString: JSON.stringify({
						createuserid:that.userId,
						createusername: that.userName,
						macadderid: that.model_data.macadderid,						
					}),
				});
				$("#restart").attr('disabled', true);
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.urltest + '/verify/watch/restartMac',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						$("#restart").attr('disabled', false);
						if(msg.responseCode == 200) {
//							console.log(msg);
							$("#myModalremove").modal('hide');
							that.tips_modal = "重启成功";	
							$('#myModal_tips').modal('show');
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						$("#restart").attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
				
			},
		},

	})
</script>